package com.tcpengine.server;

import java.util.Scanner;

import com.tcpengine.handler.GameProcess;
import com.tcpengine.handler.TcpHandler;
import com.tcpengine.handler.WsHandler;

public class Startup {

	private static Scanner input;

	public static void main(String[] args) throws Exception {
		System.out.println("启动TcpEngine测试服务端...");
		
		GameProcess gameProcess = new GameProcess();
		
		Thread webScoketService = new Thread(new WsService(gameProcess)); 	// websocket 网络服务线程
        Thread tcpService = new Thread(new TcpService(gameProcess));		// tcp 网络服务线程
		
        gameProcess.start();// 开启消息处理线程
        webScoketService.start();
        tcpService.start();
		System.out.println("开启网络服务成功...");
		System.out.println("输入exit退出");
		input = new Scanner(System.in);
		while(true) {
			String str = input.next();
			if(str == "exit") {
				break;
			}
		}
		System.out.println("服务器退出");
	}

}
